<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="android mio4kon mio">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
          移动端自动化测试系列(三)之暴力输出allure教程 - Mio4kon的博客 | Mio4kon&#39;s Blog
        
    </title>

    <link rel="canonical" href="http://mio4kon.com/2017/04/12/移动端自动化测试系列(三)之暴力输出allure教程/">

    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/hux-blog.min.css">

    <!-- Pygments Highlight CSS -->
    <link rel="stylesheet" href="/css/highlight.css">

    <!-- Custom Fonts -->
    <!-- <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> -->
    <!-- Hux change font-awesome CDN to qiniu -->
    <link href="https://cdn.staticfile.org/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">


    <!-- Hux Delete, sad but pending in China
    <link href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/
    css'>
    -->


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- ga & ba script hoook -->
    <script></script>
</head>


<!-- hack iOS CSS :active style -->
<body ontouchstart="">

    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">Mio4kon</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <!-- Known Issue, found by Hux:
            <nav>'s height woule be hold on by its content.
            so, when navbar scale out, the <nav> will cover tags.
            also mask any touch event of tags, unfortunately.
        -->
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/">Home</a>
                    </li>

                    

                        
                    

                        
                        <li>
                            <a href="/about/">About</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/archives/">Archives</a>
                        </li>
                        
                    

                        
                        <li>
                            <a href="/tags/">Tags</a>
                        </li>
                        
                    
                    
                </ul>
            </div>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>
<script>
    // Drop Bootstarp low-performance Navbar
    // Use customize navbar with high-quality material design animation
    // in high-perf jank-free CSS3 implementation
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        // CLOSE
            $navbar.className = " ";
            // wait until animation end.
            setTimeout(function(){
                // prevent frequently toggle
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        // OPEN
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>


    <!-- Main Content -->
    
<!-- Image to hack wechat -->
<!-- <img src="http://mio4kon.com/img/icon_wechat.png" width="0" height="0"> -->
<!-- <img src="{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}" width="0" height="0"> -->

<!-- Post Header -->
<style type="text/css">
    header.intro-header{
        background-image: url('/img/home-bg.jpg')
    }
</style>
<header class="intro-header" >
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <div class="tags">
                        
                          <a class="tag" href="/tags/#移动自动化测试" title="移动自动化测试">移动自动化测试</a>
                        
                    </div>
                    <h1>移动端自动化测试系列(三)之暴力输出allure教程</h1>
                    <h2 class="subheading">生成美观实用的测试报告</h2>
                    <span class="meta">
                        Posted by Mio4kon on
                        2017-04-12
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

    <!-- Post Container -->
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>之前farm了这么多资源,现在是时候让后期输出了..  </p>
<p>一个好的测试报告在整个测试框架起到至关重要的部分.最早之前使用Java写 <code>Appium</code> 框架的时候是用<a href="http://extentreports.com/" target="_blank" rel="external">extentreports</a> 做为测试报告的框架.</p>
<p>但是  <a href="http://extentreports.com/" target="_blank" rel="external">extentreports</a> 没有 python 版本.于是在网上搜寻了好久,发现很多人提到了 <code>HTMLTestRunner</code> 这个框架.自己试用了一下,发现生成的测试报告实在是太丑了.而且对 python3 的支持也不是很好.最终发现一个超好用的报告框架,不仅报告美观,而且方便CI集成.</p>
<p>那就是 <a href="http://allure.qatools.ru/" target="_blank" rel="external">Allure Test Report</a></p>
<p>我们来看一下最后的报告图:</p>
<p><img src="http://mio4kon.qiniudn.com/14919905729483.jpg" alt=""></p>
<p>是不是很赞? 这里有个网页demo,可以去试一试效果:</p>
<p><a href="http://ci.qatools.ru/job/allure1_master-deploy/lastSuccessfulBuild/Allure_report/" target="_blank" rel="external">Demo</a></p>
<p>现在就让我们使用这个强大框架来生成测试报告吧.本教程基于测试框架 <strong>pytest</strong>,如果对于这个框架不太熟悉的可以参考之前写的一篇博客</p>
<p><a href="http://mio4kon.com/2017/04/12/%E7%A7%BB%E5%8A%A8%E7%AB%AF%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95%E7%B3%BB%E5%88%97(%E4%BA%8C">移动端自动化测试系列之二——利器pytest教程</a>%E4%B9%8B%E5%88%A9%E5%99%A8pytest%E6%95%99%E7%A8%8B/)</p>
<h1 id="Allure-使用"><a href="#Allure-使用" class="headerlink" title="Allure 使用"></a>Allure 使用</h1><h2 id="安装-adapter"><a href="#安装-adapter" class="headerlink" title="安装 adapter"></a>安装 adapter</h2><p>如果要在 <code>pytest</code> 中使用 <code>Allure</code>,需要使用一个 <code>Adaptor</code></p>
<p><a href="https://github.com/allure-framework/allure-pytest" target="_blank" rel="external">Allure Pytest Adaptor</a></p>
<p>安装 <code>pytest-allure-adaptor</code></p>
<pre><code>pip3 install pytest-allure-adaptor
</code></pre><h2 id="生成报告"><a href="#生成报告" class="headerlink" title="生成报告"></a>生成报告</h2><p>还是基于我们上一篇讲解 pytest 所写的代码</p>
<p>现在我们需要做的只是一行命令!在执行原先的命令之后加一句配置即可</p>
<pre><code>pytest -s -q --alluredir report
或者
pytest -s -q --alluredir [path_to_report_dir]    
</code></pre><p>这时候你就会发现用例执行完成之后会在当前目录下生成了一个report文件</p>
<p><img src="http://mio4kon.qiniudn.com/14919921663000.jpg" alt=""></p>
<p>打开xml会发现一堆乱七八糟的东西.坑爹呢.说好的报告美观呢?(掀桌</p>
<p>这个文件夹的东西很重要,最终生成好看的报告就是靠他们.但再生成之前需要先装一个生成工具.</p>
<h2 id="生成好看的报告"><a href="#生成好看的报告" class="headerlink" title="生成好看的报告"></a>生成好看的报告</h2><p>生成工具有很多种,相关文档可以参考下面</p>
<p><a href="https://github.com/allure-framework/allure1/wiki#generating-a-report" target="_blank" rel="external">Generating a report</a></p>
<p>它支持 <code>gradle Plugin</code> ,<code>Jenkins Plugin</code>等等.这里我们简单的使用 <a href="http://wiki.qatools.ru/display/AL/Allure+Commandline" target="_blank" rel="external">Command</a> 的方式生成报告.</p>
<p>安装 Command Tool</p>
<pre><code>brew tap qatools/formulas 
brew install allure-commandline
</code></pre><p>生成 Report    </p>
<pre><code>allure generate directory-with-results/ -o directory-with-report
这里我们的命令是
allure generate report/ -o report/html
</code></pre><p>最终报告会生成在 <code>report/html</code> 目录下</p>
<p><img src="http://mio4kon.qiniudn.com/14919929175351.jpg" alt=""></p>
<p>打开 <code>index.html</code>,之前写的 case 报告就会呈现在你面前.</p>
<p>注: 如果打开一直在转圈圈,可以换个浏览器打开.</p>
<p>这里有个弊端,每次xml报告生成完了,都要调用命令转成html,后续的博客会使用一个shell命令来自动生成这个报告.当然如果要集成CI可以使用 <a href="http://wiki.qatools.ru/display/AL/Allure+Jenkins+Plugin" target="_blank" rel="external">Jenkins Plugin</a></p>
<h2 id="定制报告Steps"><a href="#定制报告Steps" class="headerlink" title="定制报告Steps"></a>定制报告Steps</h2><p>为了让生成的报告可读性更高,可以用一些 Api 来实现,比如下面我们将原先的 case 稍作改造</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># content of test_sample.py</span></div><div class="line"><span class="keyword">import</span> allure</div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">TestSample</span>:</span></div><div class="line">    <span class="function"><span class="keyword">def</span> <span class="title">test_login</span><span class="params">(self)</span>:</span></div><div class="line">        allure.attach(<span class="string">'描述'</span>, <span class="string">'这是一个注册登录的case'</span>)</div><div class="line">        self.register()</div><div class="line">        result = self.login(<span class="string">'mio4kon'</span>)</div><div class="line">        <span class="keyword">assert</span> result</div><div class="line"></div><div class="line"><span class="meta">    @allure.step(title="登录账号:&#123;1&#125;")</span></div><div class="line">    <span class="function"><span class="keyword">def</span> <span class="title">login</span><span class="params">(self, account)</span>:</span></div><div class="line">        <span class="keyword">return</span> <span class="keyword">True</span></div><div class="line"></div><div class="line"><span class="meta">    @allure.step(title="注册")</span></div><div class="line">    <span class="function"><span class="keyword">def</span> <span class="title">register</span><span class="params">(self)</span>:</span></div><div class="line">        <span class="keyword">pass</span></div></pre></td></tr></table></figure>
<p>上面是一个模拟注册然后操作的case,我们通过 <code>@allure.step</code> 和 <code>allure.attach</code> 可以让生成的报告更直观一点.</p>
<p>其中</p>
<pre><code>@allure.step(title=&quot;登录账号:{1}&quot;)
def login(self, account):
</code></pre><p><code>{1}</code>会填充为该注释下的方法的第二个参数值,第一个参数为<code>{0}</code></p>
<p>让我们看看报告吧:点击 <code>xUnit-&gt;对应的Test suites</code></p>
<p><img src="http://mio4kon.qiniudn.com/14919968331468.jpg" alt=""></p>
<p>点击描述</p>
<p><img src="http://mio4kon.qiniudn.com/14919968658481.jpg" alt=""></p>
<p>这样每一个case具体做了什么就会非常直观.分析报告也更加容易.</p>
<h2 id="severity"><a href="#severity" class="headerlink" title="severity"></a>severity</h2><p>可以为每个测试方法或者类都添加一个severity(严重等级),这么做的好处在于</p>
<ol>
<li>测试完成后告诉开发,等级严重的bug优先修复.</li>
<li><p>执行测试用例可以只针对某一个或某几个等级执行,其他等级都跳过.</p>
 <figure class="highlight python"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@pytest.allure.severity(pytest.allure.severity_level.MINOR)</span></div><div class="line"><span class="function"><span class="keyword">def</span> <span class="title">test_minor</span><span class="params">()</span>:</span></div><div class="line">    <span class="keyword">assert</span> <span class="keyword">False</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="meta">@pytest.allure.severity(pytest.allure.severity_level.CRITICAL)</span></div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">TestBar</span>:</span></div></pre></td></tr></table></figure>
</li>
</ol>
<p>如果希望只跑<code>critical</code>和<code>blocker</code>这两个等级的case</p>
<p>在原先命令上加上<code>--allure_severities=critical,blocker</code>参数</p>
<pre><code>py.test --alluredir report --allure_severities=critical,blocker -s -q
</code></pre><p>有五类严重等级,可以点击测试报告的<code>Graph</code>查看,其中灰色的为跳过的 case</p>
<p><img src="http://mio4kon.qiniudn.com/14919979342135.jpg" alt=""></p>
<h2 id="Features-amp-Stories"><a href="#Features-amp-Stories" class="headerlink" title="Features &amp; Stories"></a>Features &amp; Stories</h2><p>使用Features和Stories的好处</p>
<ol>
<li>case分类清晰明了</li>
<li>与 severity一样,可以指定只执行某 <code>Features/Stories</code> 的 case</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"><span class="meta">@allure.feature('Feature1')</span></div><div class="line"><span class="meta">@allure.story('Story1')</span></div><div class="line"><span class="function"><span class="keyword">def</span> <span class="title">test_minor</span><span class="params">()</span>:</span></div><div class="line">    <span class="keyword">assert</span> <span class="keyword">False</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="meta">@allure.feature('Feature2')</span></div><div class="line"><span class="meta">@allure.story('Story2', 'Story3')</span></div><div class="line"><span class="meta">@allure.story('Story4')</span></div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">TestBar</span>:</span></div><div class="line">    <span class="comment"># will have 'Feature2 and Story2 and Story3 and Story4'</span></div><div class="line">    <span class="function"><span class="keyword">def</span> <span class="title">test_bar</span><span class="params">(self)</span>:</span></div><div class="line">        <span class="keyword">pass</span></div></pre></td></tr></table></figure>
<p>只执行部分 <code>feature/stories</code> 的话,用下面命令</p>
<pre><code>py.test --alluredir report --allure_features=feature1,feature2 --allure_stories=story1,story2
</code></pre><p>在测试报告的<code>Behaviors</code>中可以清晰的看到分类</p>
<p><img src="http://mio4kon.qiniudn.com/14919989065999.jpg" alt=""></p>
<p><code>Allure</code> 的用法大致介绍完了,大部分示例都是来自 <code>adapter</code> 的 <code>Gayhub</code>,更多的内容请参考下面的链接.</p>
<h1 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h1><p><a href="https://github.com/allure-framework/allure-pytest" target="_blank" rel="external">https://github.com/allure-framework/allure-pytest</a></p>
<p><a href="http://wiki.qatools.ru/display/AL/Getting+Started" target="_blank" rel="external">http://wiki.qatools.ru/display/AL/Getting+Started</a></p>


                <hr>

                

                <ul class="pager">
                    
                    
                        <li class="next">
                            <a href="/2017/04/12/移动端自动化测试系列之二——利器pytest教程/" data-toggle="tooltip" data-placement="top" title="移动端自动化测试系列之二——利器pytest教程">Next Post &rarr;</a>
                        </li>
                    
                </ul>

                

                
                <!-- disqus 评论框 start -->
                <div class="comment">
                    <div id="disqus_thread" class="disqus-thread"></div>
                </div>
                <!-- disqus 评论框 end -->
                

            </div>
    <!-- Side Catalog Container -->
        
            <div class="
                col-lg-2 col-lg-offset-0
                visible-lg-block
                sidebar-container
                catalog-container">
                <div class="side-catalog">
                    <hr class="hidden-sm hidden-xs">
                    <h5>
                        <a class="catalog-toggle" href="#">CATALOG</a>
                    </h5>
                    <ul class="catalog-body"></ul>
                </div>
            </div>
        

    <!-- Sidebar Container -->

            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                <!-- Featured Tags -->
                
                <section>
                    <!-- no hr -->
                    <h5><a href="/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                       
                          <a class="tag" href="/tags/#移动自动化测试" title="移动自动化测试">移动自动化测试</a>
                        
                    </div>
                </section>
                

                <!-- Friends Blog -->
                
                <hr>
                <h5>FRIENDS</h5>
                <ul class="list-inline">

                    
                        <li><a href="http://lrd.ele.me/" target="_blank">lrd ele&#39;s Blog</a></li>
                    
                </ul>
                
            </div>

        </div>
    </div>
</article>




<!-- disqus 公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES * * */
    var disqus_shortname = "hexo-theme-huxblog";
    var disqus_identifier = "http://mio4kon.com/2017/04/12/移动端自动化测试系列(三)之暴力输出allure教程/";
    var disqus_url = "http://mio4kon.com/2017/04/12/移动端自动化测试系列(三)之暴力输出allure教程/";

    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<!-- disqus 公共JS代码 end -->




<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>
<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
<script>
    async("https://cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){
        anchors.options = {
          visible: 'always',
          placement: 'right',
          icon: '#'
        };
        anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
    })
</script>
<style>
    /* place left on bigger screen */
    @media all and (min-width: 800px) {
        .anchorjs-link{
            position: absolute;
            left: -0.75em;
            font-size: 1.1em;
            margin-top : -0.1em;
        }
    }
</style>



    <!-- Footer -->
    <!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                
                
                

                
                    <li>
                        <a target="_blank" href="http://weibo.com/u/3198010790">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-weibo fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                
                    <li>
                        <a target="_blank"  href="https://github.com/Mio4kon">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
                

                

                </ul>
                <p class="copyright text-muted">
                    Copyright &copy; Mio4kon 2017 
                    <br>
                    Theme by <a href="http://huangxuan.me">Hux</a> 
                    <span style="display: inline-block; margin: 0 5px;">
                        <i class="fa fa-heart"></i>
                    </span> 
                    Ported by <a href="http://blog.kaijun.rocks">Kaijun</a> | 
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="91px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=kaijun&repo=hexo-theme-huxblog&type=star&count=true" >
                    </iframe>
                </p>
            </div>
        </div>
    </div>
</footer>

<!-- jQuery -->
<script src="/js/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="/js/bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="/js/hux-blog.min.js"></script>


<!-- async load function -->
<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>

<!-- 
     Because of the native support for backtick-style fenced code blocks 
     right within the Markdown is landed in Github Pages, 
     From V1.6, There is no need for Highlight.js, 
     so Huxblog drops it officially.

     - https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0  
     - https://help.github.com/articles/creating-and-highlighting-code-blocks/    
-->
<!--
    <script>
        async("http://cdn.bootcss.com/highlight.js/8.6/highlight.min.js", function(){
            hljs.initHighlightingOnLoad();
        })
    </script>
    <link href="http://cdn.bootcss.com/highlight.js/8.6/styles/github.min.css" rel="stylesheet">
-->


<!-- jquery.tagcloud.js -->
<script>
    // only load tagcloud.js in tag.html
    if($('#tag_cloud').length !== 0){
        async("http://mio4kon.com/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                //size: {start: 1, end: 1, unit: 'em'},
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>

<!--fastClick.js -->
<script>
    async("https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<!-- Google Analytics -->




<!-- Baidu Tongji -->


<!-- Side Catalog -->

<script type="text/javascript">
    function generateCatalog (selector) {
        var P = $('div.post-container'),a,n,t,l,i,c;
        a = P.find('h1,h2,h3,h4,h5,h6');
        a.each(function () {
            n = $(this).prop('tagName').toLowerCase();
            i = "#"+$(this).prop('id');
            t = $(this).text();
            c = $('<a href="'+i+'" rel="nofollow">'+t+'</a>');
            l = $('<li class="'+n+'_nav"></li>').append(c);
            $(selector).append(l);
        });
        return true;    
    }

    generateCatalog(".catalog-body");

    // toggle side catalog
    $(".catalog-toggle").click((function(e){
        e.preventDefault();
        $('.side-catalog').toggleClass("fold")
    }))

    /*
     * Doc: https://github.com/davist11/jQuery-One-Page-Nav
     * Fork by Hux to support padding
     */
    async("/js/jquery.nav.js", function () {
        $('.catalog-body').onePageNav({
            currentClass: "active",
            changeHash: !1,
            easing: "swing",
            filter: "",
            scrollSpeed: 700,
            scrollOffset: 0,
            scrollThreshold: .2,
            begin: null,
            end: null,
            scrollChange: null,
            padding: 80
        });
    });
</script>





<!-- Image to hack wechat -->
<img src="http://mio4kon.com/img/icon_wechat.png" width="0" height="0" />
<!-- Migrate from head to bottom, no longer block render and still work -->

</body>

</html>
